//
//  UIColor+ZZCExtension.m
//  ZZC-Finance
//
//  Created by mac on 2017/5/21.
//  Copyright © 2017年 mac. All rights reserved.
//

#import "UIColor+ZZCExtension.h"

@implementation UIColor (ZZCExtension)
+ (UIColor *)colorWithHex:(NSInteger)hexValue {
    return [self colorWithHex:hexValue alpha:1.0];
}

+ (UIColor *)colorWithHex:(NSInteger)hexValue alpha:(CGFloat)alphaValue {
    return [self colorWithRed:((float)((hexValue & 0xFF0000) >> 16)) / 255.0
                        green:((float)((hexValue & 0xFF00) >> 8)) / 255.0
                         blue:((float)(hexValue & 0xFF)) / 255.0 alpha:alphaValue];
}

/**
 根据 RGB 色值获得 UIColor
 */
+ (UIColor *)colorWithRGBValue:(NSUInteger)RGBValue andAlpha:(CGFloat)AlphaValue{
    
    CGFloat a = (CGFloat)(RGBValue / 0x10000);
    CGFloat b = (CGFloat)(RGBValue % 0x10000 / 0x100);
    CGFloat c = (CGFloat)(RGBValue % 0x100);
    
    return [UIColor colorWithRed:a/255.0 green:b/255.0 blue:c/255.0 alpha:AlphaValue];
}
@end
